package controller;

import exception.NotEnoughMoneyException;
import service.WalletService;

import java.util.List;

public class WalletController {

        // 通过构造函数或者IOC框架注入
        private WalletService walletService = new WalletService();

        public void getBalance(int walletId) {System.out.println(walletService.getBalance(walletId));} // 查询余额
        public void getFlows(int walletId) { for(String flow : walletService.getFlows(walletId)){ System.out.println(flow); }} //查询交易记录
        public void withdraw(int walletId, double money) throws NotEnoughMoneyException { walletService.withdraw(walletId, money); } //提现
        public void recharge(int walletId, double money) { walletService.recharge(walletId, money); } //充值
        public void transfer(int fromWalletId, int toWalletId, double amount) throws NotEnoughMoneyException { walletService.pay(fromWalletId,toWalletId,amount); } //支付
        public void freezeBalance(int walletId, double money) throws NotEnoughMoneyException { walletService.freezeBalance(walletId,money); } // 冻结金额
        public void authorizedOverdraft(int walletId, double limit){ walletService.authorizedOverdraft(walletId,limit); } // 开启透支功能并设置透支额度
        public void unAuthorizedOverdraft(int walletId){ walletService.unAuthorizedOverdraft(walletId); } // 取消透支功能

}
